![]() Acrobat file (159K) |
![]() ClarisWorks 4 file (44K) |
![]() not available yet |
Technote 1058 | JULY 1996 |
By Ingrid Kelly
inge@apple.com
Apple Developer Technical Support
(DTS)
For some time now, Apple developers have been confused by the 'ptyp' (paper type) resource in QuickDraw GX. This is a result of sparse documentation and problems with QuickDraw GX's use of this resource. This Technote :
The following section introduces you to the internal structure of the 'ptyp' resource.
Definition
The paper type resource, of type gxPaperTypeType, provides you with a mechanism to create paper types that are customized for their QuickDraw GX printer driver. This resource is optional.
The structure of paper type resource is:
'ptyp' | Type |
Paper Type Name | pstring |
Page Rectangle | gxRectangle> |
Paper Rectangle | gxRectangle |
Base Paper | longint |
Creator Type | literal longint |
Unit of Measure | byte |
PaperType Style flags | unsigned bitstring |
Default flags | unsigned bitstring |
Reserved flags | unsigned bitstring |
Embedded Collection | longint |
array- Collection Items | |
- Collection tag | longint |
- Collection id | longint |
- Collection attribute bits- lock | Boolean |
- Collection attribute bits- persistent | Boolean |
- Reserved attribute bits | unsigned bitstring |
- User attribute bits | unsigned bitstring |
- Data | wstring |
The paper type resource consists of entries, flags and one or more collection items:
Constant |
|
unknownBase |
|
usLetterBase |
|
usLegalBase |
|
a4LetterBase |
|
b5LetterBase |
|
tabloidBase |
|
Constant |
|
pica |
|
mm |
|
inch |
|
Constant |
|
newStylePaperType |
|
oldStylePaperType |
|
oldAndNewStylePaperType |
|
The structure of the 'ptyp' resource can be seen in GXPrintingResTypes.r on the Developer CD Series: Mac OS SDK Edition.
For the vertical value, repeat steps 1 and 2, multiplying 10.7867 inches instead of 8.10667.
Once you are finished with the calculations, the top portion of your 'ptyp' resource will look like the following:
resource gxPaperTypeType (gxPrintingDriverBaseID+1, "US Letter", kResAttributes) { "US Letter", /*page rectangle*/ 0x00000000, /*0.0*/ 0x00000000, /*0.0*/ 0x0247AE18, /*8.10667*/ 0x0308A3DC, /*10.7867*/ /*paper rectangle*/ 0xFFF1D70C, /*-0.196666*/ 0xFFF870A8, /*-0.104999*/ 0x0247AE18, /*8.30333*/ 0x0308A3DC, /*10.895*/ usLetterType, kCreatorType, inch, etc. }
If QuickDraw GX encounters more than one paper type in your driver with the isDefaultPaperType flag set, QuickDraw GX will either fail or choose the first paper type it "sees." In either case, it is not a good idea to have more than one paper type in your resource fork with the isDefaultPaperType flag set.
Workaround #1:
If you are defaulting to a non-standard papertype, such as Letterhead, Stationery or Three-hole Punch, the best workaround is to remove that papertype from the Extensions folder.
Workaround #2:
If you are defaulting to another standard papertype, the easiest thing you can do is to open your driver with ResEdit and either remove or edit the 'ptyp' resource for the incorrectly matched papertype.
Currently, these are the only known workarounds. Neither may be very user-friendly, but in both cases, they ought to force the driver to default to the correct papertype.
Developers are usually interested in how they can use the Paper Type Editor to create paper type resources to ship with their QuickDraw GX printer drivers. In order to convert the paper type that the Paper Type Editor creates into a 'ptyp' resource, you need to DeRez the paper type, set the oldAndNewStylePaperType flag (and the isDefaultPaperType flag if necessary), Rez it back and copy it into your printer driver's resource fork. After restarting, the paper types should correctly appear in your QuickDraw GX printer driver.
Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help